, property injection, and method call injection. We can use examples to implement these three forms of injection. Take the preceding scenario as an example:
1. constructor Injection
IMonitor interface definition:
1: public interface IMonitor
2: {
3: void Alarm();
4: }
Monitor class:
1: public class Monitor : IMonitor
2: {
3: p
.
Take my code as an example:Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Using System;Using System. Collections. Generic;Using System. ComponentModel;Using System. Drawing;Using System. Data;Using System. Text;Using System. Windows. Forms;Using System. Runtime. InteropServices;Namespace EstatePrintMapActiveX{// Control class. GUID can be generated in the tool. The GUID here is the CLASSID used to reference the control on the page.// C
graph templatesAddGraph templates(For example, the temysql-index usage template, which is a series of templates starting with temysql ). And click the topCreate graphs for this hostLink. In the graph templates selection box, select temysql-index usage and click Create. the following web page is displayed.
Enter the username and password for accessing the MySQL database and click Create.
Select the newly added graph templates and click Create to create a graph.
Select graph trees from the left
(); int _onRecvFromSession(ITServerSession s, Msg.MsgInfo msg); int _onRegister(Msg.ReguestRegister reg, ITableRegChange ic); void _onUpdateRegInfo(String src, ITableRegChange ic); int _onAddSession(ITServerSession s); }
The above class ITBusStub is a stub class, which is mainly used to inherit an interface class, and its implementation class only needs to implement this interface, the method to be called. BusStub is its implementation class.
public class BusStub extends A
_onRecvResult(Msg.MsgInfo msg); 15 Msg.MsgInfo _onNeedExec(); 16 int _onRecvFromSession(ITServerSession s, Msg.MsgInfo msg); 17 int _onRegister(Msg.ReguestRegister reg, ITableRegChange ic); 18 void _onUpdateRegInfo(String src, ITableRegChange ic); 19 int _onAddSession(ITServerSession s); 20 } The above class itbusstub is a stub class, which is mainly used to inherit an interface class, and its implementation class only needs to implement this interface, the
Original address: http://www.cnblogs.com/zhf/archive/2009/03/02/1401299.htmlDevelopment environment for VS 2005,. NET Framework 2.0Project, new fileThe following dialog box pops upSelect Windows Control Library Enter a name TestControl click "OK"In the design window, drag the control Label1 Timer 2 buttons such as:1. com's interface and class creationCOM Interface (Interface): IMonitorCodeCOM Class (Class): MonitorCode1) The GUID specifies the GUID of the class or interface.2) Declare the attrib
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.